package site.wanjiahao.client;


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;

/**
 * 获取文件元数据请求
 */
public class FetchFileMetaDataHttpRequest extends HttpGet {
    
    private final StringBuilder data = new StringBuilder();

    public FetchFileMetaDataHttpRequest(String url) {
        this.url = url;
    }

    public String getEntity() {
        return data.toString();
    }

    @Override
    protected void handler() throws IOException {
        //将响应流转换成字符串
        String line;
        BufferedReader reader = new BufferedReader(new InputStreamReader(getInputStream(), StandardCharsets.UTF_8));
        while ((line = reader.readLine()) != null) {
            data.append(line);
        }
    }


}
